@@ -7,13 +7,14 @@ use Module::Build 0.3601;
my %module_build_args = (
'build_requires' => {
- 'Carp' => '0',
- 'English' => '0',
'File::Find' => '0',
+ 'File::Path' => '0',
'File::Temp' => '0',
'Module::Build' => '0.3601',
- 'Scalar::Util' => '0',
- 'Test::More' => '0.94'
+ 'Moose::Autobox' => '0',
+ 'Test::DZil' => '0',
+ 'Test::More' => '0.94',
+ 'autodie' => '0'
},
'configure_requires' => {
'Module::Build' => '0.3601'
@@ -23,7 +24,7 @@ my %module_build_args = (
'Jerome Quelin'
],
'dist_name' => 'Dist-Zilla-Plugin-CriticTests',
- 'dist_version' => '1.102280',
+ 'dist_version' => '1.111450',
'license' => 'perl',
'module_name' => 'Dist::Zilla::Plugin::CriticTests',
'recommends' => {},
@@ -1,5 +1,8 @@
Revision history for Dist::Zilla::Plugin::CriticTests
+1.111450 2011-05-25 09:42:23 Europe/Paris
+ - fix rt#68451 - undef critic_config should be treated as '' (mike doherty)
+
1.102280 2010-08-16 19:28:00 Europe/Paris
- fix rt#60360 - Eliminated 2-phase inject/munge in favour of one-phase
filegatherer templating. Eliminates ordering confusion
@@ -2,19 +2,17 @@ Build.PL
Changes
LICENSE
MANIFEST
+META.json
META.yml
README
dist.ini
examples/dist.ini
lib/Dist/Zilla/Plugin/CriticTests.pm
t/00-compile.t
-t/000-report-versions.t
-t/author-critic.t
-t/release-distmeta.t
+t/000-report-versions-tiny.t
+t/manifest.t
t/release-has-version.t
t/release-kwalitee.t
t/release-minimum-version.t
t/release-pod-coverage.t
t/release-pod-syntax.t
-t/release-portability.t
-t/release-unused-vars.t
@@ -0,0 +1,302 @@
+{
+ "abstract" : "tests to check your code against best practices",
+ "author" : [
+ "Jerome Quelin"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 4.200004, CPAN::Meta::Converter version 2.110930",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Dist-Zilla-Plugin-CriticTests",
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "Module::Build" : "0.3601"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "Module::Build" : "0.3601"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Data::Section" : "0.004",
+ "Dist::Zilla::File::InMemory" : 0,
+ "Dist::Zilla::Role::FileGatherer" : 0,
+ "Dist::Zilla::Role::TextTemplate" : 0,
+ "Moose" : 0,
+ "Moose::Util" : 0,
+ "perl" : "5.008"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "File::Find" : 0,
+ "File::Path" : 0,
+ "File::Temp" : 0,
+ "Moose::Autobox" : 0,
+ "Test::DZil" : 0,
+ "Test::More" : "0.94",
+ "autodie" : 0
+ }
+ }
+ },
+ "provides" : {
+ "Dist::Zilla::Plugin::CriticTests" : {
+ "file" : "lib/Dist/Zilla/Plugin/CriticTests.pm",
+ "version" : "1.111450"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "mailto" : "bug-dist-zilla-plugin-critictests at rt.cpan.org",
+ "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-CriticTests"
+ },
+ "homepage" : "http://search.cpan.org/dist/Dist-Zilla-Plugin-CriticTests/",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/jquelin/dist-zilla-plugin-critictests.git",
+ "web" : "http://github.com/jquelin/dist-zilla-plugin-critictests"
+ }
+ },
+ "version" : "1.111450",
+ "x_Dist_Zilla" : {
+ "plugins" : [
+ {
+ "class" : "Dist::Zilla::Plugin::MetaResources",
+ "name" : "MetaResources",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::AutoVersion",
+ "name" : "@JQUELIN/AutoVersion",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::GatherDir",
+ "name" : "@JQUELIN/GatherDir",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::CompileTests",
+ "name" : "@JQUELIN/CompileTests",
+ "version" : "1.110930"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::HasVersionTests",
+ "name" : "@JQUELIN/HasVersionTests",
+ "version" : "1.101420"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::KwaliteeTests",
+ "name" : "@JQUELIN/KwaliteeTests",
+ "version" : "1.101420"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MinimumVersionTests",
+ "name" : "@JQUELIN/MinimumVersionTests",
+ "version" : "1.101421"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodCoverageTests",
+ "name" : "@JQUELIN/PodCoverageTests",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
+ "name" : "@JQUELIN/PodSyntaxTests",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ReportVersions::Tiny",
+ "name" : "@JQUELIN/ReportVersions::Tiny",
+ "version" : "1.03"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PruneCruft",
+ "name" : "@JQUELIN/PruneCruft",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PruneFiles",
+ "name" : "@JQUELIN/PruneFiles",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ManifestSkip",
+ "name" : "@JQUELIN/ManifestSkip",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::AutoPrereqs",
+ "name" : "@JQUELIN/AutoPrereqs",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ExtraTests",
+ "name" : "@JQUELIN/ExtraTests",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::NextRelease",
+ "name" : "@JQUELIN/NextRelease",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PkgVersion",
+ "name" : "@JQUELIN/PkgVersion",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodWeaver",
+ "name" : "@JQUELIN/PodWeaver",
+ "version" : "3.101641"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prepender",
+ "name" : "@JQUELIN/Prepender",
+ "version" : "1.103470"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ExecDir",
+ "name" : "@JQUELIN/ExecDir",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ShareDir",
+ "name" : "@JQUELIN/ShareDir",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Bugtracker",
+ "name" : "@JQUELIN/Bugtracker",
+ "version" : "1.111080"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Homepage",
+ "name" : "@JQUELIN/Homepage",
+ "version" : "1.101420"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Repository",
+ "name" : "@JQUELIN/Repository",
+ "version" : "0.17"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaProvides::Package",
+ "name" : "@JQUELIN/MetaProvides::Package",
+ "version" : "1.12060501"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaConfig",
+ "name" : "@JQUELIN/MetaConfig",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::License",
+ "name" : "@JQUELIN/License",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaYAML",
+ "name" : "@JQUELIN/MetaYAML",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaJSON",
+ "name" : "@JQUELIN/MetaJSON",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ModuleBuild",
+ "name" : "@JQUELIN/ModuleBuild",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Readme",
+ "name" : "@JQUELIN/Readme",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Manifest",
+ "name" : "@JQUELIN/Manifest",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::CheckChangeLog",
+ "name" : "@JQUELIN/CheckChangeLog",
+ "version" : "0.01"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Check",
+ "name" : "@JQUELIN/Git::Check",
+ "version" : "1.110500"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Commit",
+ "name" : "@JQUELIN/Git::Commit",
+ "version" : "1.110500"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::CommitBuild",
+ "name" : "@JQUELIN/Git::CommitBuild",
+ "version" : "1.110500"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Tag",
+ "name" : "@JQUELIN/TagMaster",
+ "version" : "1.110500"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Tag",
+ "name" : "@JQUELIN/TagRelease",
+ "version" : "1.110500"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Push",
+ "name" : "@JQUELIN/Git::Push",
+ "version" : "1.110500"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::UploadToCPAN",
+ "name" : "@JQUELIN/UploadToCPAN",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":InstallModules",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":TestFiles",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":ExecFiles",
+ "version" : "4.200004"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":ShareFiles",
+ "version" : "4.200004"
+ }
+ ],
+ "zilla" : {
+ "class" : "Dist::Zilla::Dist::Builder",
+ "config" : {
+ "is_trial" : 0
+ },
+ "version" : "4.200004"
+ }
+ }
+}
+
@@ -3,17 +3,18 @@ abstract: 'tests to check your code against best practices'
author:
- 'Jerome Quelin'
build_requires:
- Carp: 0
- English: 0
File::Find: 0
+ File::Path: 0
File::Temp: 0
Module::Build: 0.3601
- Scalar::Util: 0
+ Moose::Autobox: 0
+ Test::DZil: 0
Test::More: 0.94
+ autodie: 0
configure_requires:
Module::Build: 0.3601
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.102160'
+generated_by: 'Dist::Zilla version 4.200004, CPAN::Meta::Converter version 2.110930'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -22,7 +23,7 @@ name: Dist-Zilla-Plugin-CriticTests
provides:
Dist::Zilla::Plugin::CriticTests:
file: lib/Dist/Zilla/Plugin/CriticTests.pm
- version: 1.102280
+ version: 1.111450
requires:
Data::Section: 0.004
Dist::Zilla::File::InMemory: 0
@@ -34,30 +35,26 @@ requires:
resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-CriticTests
homepage: http://search.cpan.org/dist/Dist-Zilla-Plugin-CriticTests/
- repository: http://github.com/jquelin/dist-zilla-plugin-critictests
-version: 1.102280
+ repository: git://github.com/jquelin/dist-zilla-plugin-critictests.git
+version: 1.111450
x_Dist_Zilla:
plugins:
-
class: Dist::Zilla::Plugin::MetaResources
name: MetaResources
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::AutoVersion
name: '@JQUELIN/AutoVersion'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::GatherDir
name: '@JQUELIN/GatherDir'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::CompileTests
name: '@JQUELIN/CompileTests'
- version: 1.101800
- -
- class: Dist::Zilla::Plugin::CriticTests
- name: '@JQUELIN/CriticTests'
- version: 1.100140
+ version: 1.110930
-
class: Dist::Zilla::Plugin::HasVersionTests
name: '@JQUELIN/HasVersionTests'
@@ -67,77 +64,69 @@ x_Dist_Zilla:
name: '@JQUELIN/KwaliteeTests'
version: 1.101420
-
- class: Dist::Zilla::Plugin::MetaTests
- name: '@JQUELIN/MetaTests'
- version: 4.101900
- -
class: Dist::Zilla::Plugin::MinimumVersionTests
name: '@JQUELIN/MinimumVersionTests'
version: 1.101421
-
class: Dist::Zilla::Plugin::PodCoverageTests
name: '@JQUELIN/PodCoverageTests'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@JQUELIN/PodSyntaxTests'
- version: 4.101900
- -
- class: Dist::Zilla::Plugin::PortabilityTests
- name: '@JQUELIN/PortabilityTests'
- version: 1.101420
+ version: 4.200004
-
- class: Dist::Zilla::Plugin::ReportVersions
- name: '@JQUELIN/ReportVersions'
- version: 1.101700
- -
- class: Dist::Zilla::Plugin::UnusedVarsTests
- name: '@JQUELIN/UnusedVarsTests'
- version: 1.100860
+ class: Dist::Zilla::Plugin::ReportVersions::Tiny
+ name: '@JQUELIN/ReportVersions::Tiny'
+ version: 1.03
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@JQUELIN/PruneCruft'
- version: 4.101900
+ version: 4.200004
+ -
+ class: Dist::Zilla::Plugin::PruneFiles
+ name: '@JQUELIN/PruneFiles'
+ version: 4.200004
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@JQUELIN/ManifestSkip'
- version: 4.101900
+ version: 4.200004
-
- class: Dist::Zilla::Plugin::AutoPrereq
- name: '@JQUELIN/AutoPrereq'
- version: 4.101900
+ class: Dist::Zilla::Plugin::AutoPrereqs
+ name: '@JQUELIN/AutoPrereqs'
+ version: 4.200004
-
class: Dist::Zilla::Plugin::ExtraTests
name: '@JQUELIN/ExtraTests'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::NextRelease
name: '@JQUELIN/NextRelease'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::PkgVersion
name: '@JQUELIN/PkgVersion'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::PodWeaver
name: '@JQUELIN/PodWeaver'
- version: 3.101640
+ version: 3.101641
-
class: Dist::Zilla::Plugin::Prepender
name: '@JQUELIN/Prepender'
- version: 1.101590
+ version: 1.103470
-
class: Dist::Zilla::Plugin::ExecDir
name: '@JQUELIN/ExecDir'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::ShareDir
name: '@JQUELIN/ShareDir'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::Bugtracker
name: '@JQUELIN/Bugtracker'
- version: 1.101490
+ version: 1.111080
-
class: Dist::Zilla::Plugin::Homepage
name: '@JQUELIN/Homepage'
@@ -145,77 +134,89 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::Repository
name: '@JQUELIN/Repository'
- version: 0.13
+ version: 0.17
-
class: Dist::Zilla::Plugin::MetaProvides::Package
name: '@JQUELIN/MetaProvides::Package'
- version: 1.11034304
+ version: 1.12060501
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@JQUELIN/MetaConfig'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::License
name: '@JQUELIN/License'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@JQUELIN/MetaYAML'
- version: 4.101900
+ version: 4.200004
+ -
+ class: Dist::Zilla::Plugin::MetaJSON
+ name: '@JQUELIN/MetaJSON'
+ version: 4.200004
-
class: Dist::Zilla::Plugin::ModuleBuild
name: '@JQUELIN/ModuleBuild'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::Readme
name: '@JQUELIN/Readme'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::Manifest
name: '@JQUELIN/Manifest'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::CheckChangeLog
name: '@JQUELIN/CheckChangeLog'
version: 0.01
-
- class: Dist::Zilla::Plugin::UploadToCPAN
- name: '@JQUELIN/UploadToCPAN'
- version: 4.101900
- -
class: Dist::Zilla::Plugin::Git::Check
- name: '@JQUELIN/Git/Check'
- version: 1.102090
+ name: '@JQUELIN/Git::Check'
+ version: 1.110500
-
class: Dist::Zilla::Plugin::Git::Commit
- name: '@JQUELIN/Git/Commit'
- version: 1.102090
+ name: '@JQUELIN/Git::Commit'
+ version: 1.110500
+ -
+ class: Dist::Zilla::Plugin::Git::CommitBuild
+ name: '@JQUELIN/Git::CommitBuild'
+ version: 1.110500
+ -
+ class: Dist::Zilla::Plugin::Git::Tag
+ name: '@JQUELIN/TagMaster'
+ version: 1.110500
-
class: Dist::Zilla::Plugin::Git::Tag
- name: '@JQUELIN/Git/Tag'
- version: 1.102090
+ name: '@JQUELIN/TagRelease'
+ version: 1.110500
-
class: Dist::Zilla::Plugin::Git::Push
- name: '@JQUELIN/Git/Push'
- version: 1.102090
+ name: '@JQUELIN/Git::Push'
+ version: 1.110500
+ -
+ class: Dist::Zilla::Plugin::UploadToCPAN
+ name: '@JQUELIN/UploadToCPAN'
+ version: 4.200004
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
- version: 4.101900
+ version: 4.200004
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
- version: 4.101900
+ version: 4.200004
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: 0
- version: 4.101900
+ version: 4.200004
@@ -1,7 +1,7 @@
This archive contains the distribution Dist-Zilla-Plugin-CriticTests,
-version 1.102280:
+version 1.111450:
tests to check your code against best practices
@@ -16,4 +16,5 @@ repository = http://github.com/jquelin/dist-zilla-plugin-critictests
;-remove = CriticTests
;[CriticTests]
+[Bootstrap::lib]
[@JQUELIN]
@@ -12,7 +12,7 @@ use warnings;
package Dist::Zilla::Plugin::CriticTests;
BEGIN {
- $Dist::Zilla::Plugin::CriticTests::VERSION = '1.102280';
+ $Dist::Zilla::Plugin::CriticTests::VERSION = '1.111450';
}
# ABSTRACT: tests to check your code against best practices
@@ -31,11 +31,10 @@ with qw(
has critic_config => (
is => 'ro',
- isa => 'Str',
+ isa => 'Maybe[Str]',
default => 'perlcritic.rc',
);
-
sub gather_files {
my ($self) = @_;
@@ -43,6 +42,7 @@ sub gather_files {
return unless $data and %$data;
my $stash = get_all_attribute_values( $self->meta, $self);
+ $stash->{critic_config} ||= 'perlcritic.rc';
# NB: This code is a bit generalised really, and could be forked into its
# own plugin.
@@ -70,7 +70,7 @@ Dist::Zilla::Plugin::CriticTests - tests to check your code against best practic
=head1 VERSION
-version 1.102280
+version 1.111450
=head1 SYNOPSIS
@@ -12,6 +12,9 @@ use strict;
use warnings;
use Test::More;
+
+
+
use File::Find;
use File::Temp qw{ tempdir };
@@ -29,7 +32,18 @@ find(
'lib',
);
-my @scripts = glob "bin/*";
+my @scripts;
+if ( -d 'bin' ) {
+ find(
+ sub {
+ return unless -f;
+ my $found = $File::Find::name;
+ # nothing to skip
+ push @scripts, $found;
+ },
+ 'bin',
+ );
+}
my $plan = scalar(@modules) + scalar(@scripts);
$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
@@ -0,0 +1,84 @@
+use strict;
+use warnings;
+use Test::More 0.88;
+# This is a relatively nice way to avoid Test::NoWarnings breaking our
+# expectations by adding extra tests, without using no_plan. It also helps
+# avoid any other test module that feels introducing random tests, or even
+# test plans, is a nice idea.
+our $success = 0;
+END { $success && done_testing; }
+
+my $v = "\n";
+
+eval { # no excuses!
+ # report our Perl details
+ my $want = '5.008';
+ my $pv = ($^V || $]);
+ $v .= "perl: $pv (wanted $want) on $^O from $^X\n\n";
+};
+defined($@) and diag("$@");
+
+# Now, our module version dependencies:
+sub pmver {
+ my ($module, $wanted) = @_;
+ $wanted = " (want $wanted)";
+ my $pmver;
+ eval "require $module;";
+ if ($@) {
+ if ($@ =~ m/Can't locate .* in \@INC/) {
+ $pmver = 'module not found.';
+ } else {
+ diag("${module}: $@");
+ $pmver = 'died during require.';
+ }
+ } else {
+ my $version;
+ eval { $version = $module->VERSION; };
+ if ($@) {
+ diag("${module}: $@");
+ $pmver = 'died during VERSION check.';
+ } elsif (defined $version) {
+ $pmver = "$version";
+ } else {
+ $pmver = '<undef>';
+ }
+ }
+
+ # So, we should be good, right?
+ return sprintf('%-45s => %-10s%-15s%s', $module, $pmver, $wanted, "\n");
+}
+
+eval { $v .= pmver('Data::Section','0.004') };
+eval { $v .= pmver('Dist::Zilla::File::InMemory','any version') };
+eval { $v .= pmver('Dist::Zilla::Role::FileGatherer','any version') };
+eval { $v .= pmver('Dist::Zilla::Role::TextTemplate','any version') };
+eval { $v .= pmver('File::Find','any version') };
+eval { $v .= pmver('File::Path','any version') };
+eval { $v .= pmver('File::Temp','any version') };
+eval { $v .= pmver('Module::Build','0.3601') };
+eval { $v .= pmver('Moose','any version') };
+eval { $v .= pmver('Moose::Autobox','any version') };
+eval { $v .= pmver('Moose::Util','any version') };
+eval { $v .= pmver('Test::DZil','any version') };
+eval { $v .= pmver('Test::More','0.94') };
+eval { $v .= pmver('autodie','any version') };
+
+
+
+# All done.
+$v .= <<'EOT';
+
+Thanks for using my code. I hope it works for you.
+If not, please try and include this output in the bug report.
+That will help me reproduce the issue and solve you problem.
+
+EOT
+
+diag($v);
+ok(1, "we really didn't test anything, just reporting data");
+$success = 1;
+
+# Work around another nasty module on CPAN. :/
+no warnings 'once';
+$Template::Test::NO_FLUSH = 1;
+exit 0;
@@ -1,454 +0,0 @@
-#!perl
-#
-# This file is part of Dist-Zilla-Plugin-CriticTests
-#
-# This software is copyright (c) 2009 by Jerome Quelin.
-#
-# This is free software; you can redistribute it and/or modify it under
-# the same terms as the Perl 5 programming language system itself.
-#
-use warnings;
-use strict;
-use Test::More 0.94;
-
-# Include a cut-down version of YAML::Tiny so we don't introduce unnecessary
-# dependencies ourselves.
-
-package Local::YAML::Tiny;
-
-use strict;
-use Carp 'croak';
-
-# UTF Support?
-sub HAVE_UTF8 () { $] >= 5.007003 }
-BEGIN {
- if ( HAVE_UTF8 ) {
- # The string eval helps hide this from Test::MinimumVersion
- eval "require utf8;";
- die "Failed to load UTF-8 support" if $@;
- }
-
- # Class structure
- require 5.004;
- $YAML::Tiny::VERSION = '1.40';
-
- # Error storage
- $YAML::Tiny::errstr = '';
-}
-
-# Printable characters for escapes
-my %UNESCAPES = (
- z => "\x00", a => "\x07", t => "\x09",
- n => "\x0a", v => "\x0b", f => "\x0c",
- r => "\x0d", e => "\x1b", '\\' => '\\',
-);
-
-
-#####################################################################
-# Implementation
-
-# Create an empty YAML::Tiny object
-sub new {
- my $class = shift;
- bless [ @_ ], $class;
-}
-
-# Create an object from a file
-sub read {
- my $class = ref $_[0] ? ref shift : shift;
-
- # Check the file
- my $file = shift or return $class->_error( 'You did not specify a file name' );
- return $class->_error( "File '$file' does not exist" ) unless -e $file;
- return $class->_error( "'$file' is a directory, not a file" ) unless -f _;
- return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _;
-
- # Slurp in the file
- local $/ = undef;
- local *CFG;
- unless ( open(CFG, $file) ) {
- return $class->_error("Failed to open file '$file': $!");
- }
- my $contents = <CFG>;
- unless ( close(CFG) ) {
- return $class->_error("Failed to close file '$file': $!");
- }
-
- $class->read_string( $contents );
-}
-
-# Create an object from a string
-sub read_string {
- my $class = ref $_[0] ? ref shift : shift;
- my $self = bless [], $class;
- my $string = $_[0];
- unless ( defined $string ) {
- return $self->_error("Did not provide a string to load");
- }
-
- # Byte order marks
- # NOTE: Keeping this here to educate maintainers
- # my %BOM = (
- # "\357\273\277" => 'UTF-8',
- # "\376\377" => 'UTF-16BE',
- # "\377\376" => 'UTF-16LE',
- # "\377\376\0\0" => 'UTF-32LE'
- # "\0\0\376\377" => 'UTF-32BE',
- # );
- if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) {
- return $self->_error("Stream has a non UTF-8 BOM");
- } else {
- # Strip UTF-8 bom if found, we'll just ignore it
- $string =~ s/^\357\273\277//;
- }
-
- # Try to decode as utf8
- utf8::decode($string) if HAVE_UTF8;
-
- # Check for some special cases
- return $self unless length $string;
- unless ( $string =~ /[\012\015]+\z/ ) {
- return $self->_error("Stream does not end with newline character");
- }
-
- # Split the file into lines
- my @lines = grep { ! /^\s*(?:\#.*)?\z/ }
- split /(?:\015{1,2}\012|\015|\012)/, $string;
-
- # Strip the initial YAML header
- @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines;
-
- # A nibbling parser
- while ( @lines ) {
- # Do we have a document header?
- if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) {
- # Handle scalar documents
- shift @lines;
- if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) {
- push @$self, $self->_read_scalar( "$1", [ undef ], \@lines );
- next;
- }
- }
-
- if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) {
- # A naked document
- push @$self, undef;
- while ( @lines and $lines[0] !~ /^---/ ) {
- shift @lines;
- }
-
- } elsif ( $lines[0] =~ /^\s*\-/ ) {
- # An array at the root
- my $document = [ ];
- push @$self, $document;
- $self->_read_array( $document, [ 0 ], \@lines );
-
- } elsif ( $lines[0] =~ /^(\s*)\S/ ) {
- # A hash at the root
- my $document = { };
- push @$self, $document;
- $self->_read_hash( $document, [ length($1) ], \@lines );
-
- } else {
- croak("YAML::Tiny failed to classify the line '$lines[0]'");
- }
- }
-
- $self;
-}
-
-# Deparse a scalar string to the actual scalar
-sub _read_scalar {
- my ($self, $string, $indent, $lines) = @_;
-
- # Trim trailing whitespace
- $string =~ s/\s*\z//;
-
- # Explitic null/undef
- return undef if $string eq '~';
-
- # Quotes
- if ( $string =~ /^\'(.*?)\'\z/ ) {
- return '' unless defined $1;
- $string = $1;
- $string =~ s/\'\'/\'/g;
- return $string;
- }
- if ( $string =~ /^\"((?:\\.|[^\"])*)\"\z/ ) {
- # Reusing the variable is a little ugly,
- # but avoids a new variable and a string copy.
- $string = $1;
- $string =~ s/\\"/"/g;
- $string =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}/gex;
- return $string;
- }
-
- # Special cases
- if ( $string =~ /^[\'\"!&]/ ) {
- croak("YAML::Tiny does not support a feature in line '$lines->[0]'");
- }
- return {} if $string eq '{}';
- return [] if $string eq '[]';
-
- # Regular unquoted string
- return $string unless $string =~ /^[>|]/;
-
- # Error
- croak("YAML::Tiny failed to find multi-line scalar content") unless @$lines;
-
- # Check the indent depth
- $lines->[0] =~ /^(\s*)/;
- $indent->[-1] = length("$1");
- if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) {
- croak("YAML::Tiny found bad indenting in line '$lines->[0]'");
- }
-
- # Pull the lines
- my @multiline = ();
- while ( @$lines ) {
- $lines->[0] =~ /^(\s*)/;
- last unless length($1) >= $indent->[-1];
- push @multiline, substr(shift(@$lines), length($1));
- }
-
- my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
- my $t = (substr($string, 1, 1) eq '-') ? '' : "\n";
- return join( $j, @multiline ) . $t;
-}
-
-# Parse an array
-sub _read_array {
- my ($self, $array, $indent, $lines) = @_;
-
- while ( @$lines ) {
- # Check for a new document
- if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
- while ( @$lines and $lines->[0] !~ /^---/ ) {
- shift @$lines;
- }
- return 1;
- }
-
- # Check the indent level
- $lines->[0] =~ /^(\s*)/;
- if ( length($1) < $indent->[-1] ) {
- return 1;
- } elsif ( length($1) > $indent->[-1] ) {
- croak("YAML::Tiny found bad indenting in line '$lines->[0]'");
- }
-
- if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) {
- # Inline nested hash
- my $indent2 = length("$1");
- $lines->[0] =~ s/-/ /;
- push @$array, { };
- $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines );
-
- } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) {
- # Array entry with a value
- shift @$lines;
- push @$array, $self->_read_scalar( "$2", [ @$indent, undef ], $lines );
-
- } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) {
- shift @$lines;
- unless ( @$lines ) {
- push @$array, undef;
- return 1;
- }
- if ( $lines->[0] =~ /^(\s*)\-/ ) {
- my $indent2 = length("$1");
- if ( $indent->[-1] == $indent2 ) {
- # Null array entry
- push @$array, undef;
- } else {
- # Naked indenter
- push @$array, [ ];
- $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines );
- }
-
- } elsif ( $lines->[0] =~ /^(\s*)\S/ ) {
- push @$array, { };
- $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines );
-
- } else {
- croak("YAML::Tiny failed to classify line '$lines->[0]'");
- }
-
- } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) {
- # This is probably a structure like the following...
- # ---
- # foo:
- # - list
- # bar: value
- #
- # ... so lets return and let the hash parser handle it
- return 1;
-
- } else {
- croak("YAML::Tiny failed to classify line '$lines->[0]'");
- }
- }
-
- return 1;
-}
-
-# Parse an array
-sub _read_hash {
- my ($self, $hash, $indent, $lines) = @_;
-
- while ( @$lines ) {
- # Check for a new document
- if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
- while ( @$lines and $lines->[0] !~ /^---/ ) {
- shift @$lines;
- }
- return 1;
- }
-
- # Check the indent level
- $lines->[0] =~ /^(\s*)/;
- if ( length($1) < $indent->[-1] ) {
- return 1;
- } elsif ( length($1) > $indent->[-1] ) {
- croak("YAML::Tiny found bad indenting in line '$lines->[0]'");
- }
-
- # Get the key
- unless ( $lines->[0] =~ s/^\s*([^\'\" ][^\n]*?)\s*:(\s+|$)// ) {
- if ( $lines->[0] =~ /^\s*[?\'\"]/ ) {
- croak("YAML::Tiny does not support a feature in line '$lines->[0]'");
- }
- croak("YAML::Tiny failed to classify line '$lines->[0]'");
- }
- my $key = $1;
-
- # Do we have a value?
- if ( length $lines->[0] ) {
- # Yes
- $hash->{$key} = $self->_read_scalar( shift(@$lines), [ @$indent, undef ], $lines );
- } else {
- # An indent
- shift @$lines;
- unless ( @$lines ) {
- $hash->{$key} = undef;
- return 1;
- }
- if ( $lines->[0] =~ /^(\s*)-/ ) {
- $hash->{$key} = [];
- $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines );
- } elsif ( $lines->[0] =~ /^(\s*)./ ) {
- my $indent2 = length("$1");
- if ( $indent->[-1] >= $indent2 ) {
- # Null hash entry
- $hash->{$key} = undef;
- } else {
- $hash->{$key} = {};
- $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines );
- }
- }
- }
- }
-
- return 1;
-}
-
-# Set error
-sub _error {
- $YAML::Tiny::errstr = $_[1];
- undef;
-}
-
-# Retrieve error
-sub errstr {
- $YAML::Tiny::errstr;
-}
-
-
-
-#####################################################################
-# Use Scalar::Util if possible, otherwise emulate it
-
-BEGIN {
- eval {
- require Scalar::Util;
- };
- if ( $@ ) {
- # Failed to load Scalar::Util
- eval <<'END_PERL';
-sub refaddr {
- my $pkg = ref($_[0]) or return undef;
- if (!!UNIVERSAL::can($_[0], 'can')) {
- bless $_[0], 'Scalar::Util::Fake';
- } else {
- $pkg = undef;
- }
- "$_[0]" =~ /0x(\w+)/;
- my $i = do { local $^W; hex $1 };
- bless $_[0], $pkg if defined $pkg;
- $i;
-}
-END_PERL
- } else {
- Scalar::Util->import('refaddr');
- }
-}
-
-
-#####################################################################
-# main test
-#####################################################################
-
-package main;
-
-BEGIN {
-
- # Skip modules that either don't want to be loaded directly, such as
- # Module::Install, or that mess with the test count, such as the Test::*
- # modules listed here.
- #
- # Moose::Role conflicts if Moose is loaded as well, but Moose::Role is in
- # the Moose distribution and it's certain that someone who uses
- # Moose::Role also uses Moose somewhere, so if we disallow Moose::Role,
- # we'll still get the relevant version number.
-
- my %skip = map { $_ => 1 } qw(
- App::FatPacker
- Class::Accessor::Classy
- Devel::Cover
- Module::Install
- Moose::Role
- POE::Loop::Tk
- Template::Test
- Test::Kwalitee
- Test::Pod::Coverage
- Test::Portability::Files
- Test::YAML::Meta
- );
-
- my $Test = Test::Builder->new;
-
- $Test->plan(skip_all => "META.yml could not be found")
- unless -f 'META.yml' and -r _;
-
- my $meta = (Local::YAML::Tiny->read('META.yml'))->[0];
- my %requires;
- for my $require_key (grep { /requires/ } keys %$meta) {
- my %h = %{ $meta->{$require_key} };
- $requires{$_}++ for keys %h;
- }
- delete $requires{perl};
-
- diag("Testing with Perl $], $^X");
- for my $module (sort keys %requires) {
- if ($skip{$module}) {
- note "$module doesn't want to be loaded directly, skipping";
- next;
- }
- local $SIG{__WARN__} = sub { note "$module: $_[0]" };
- use_ok $module or BAIL_OUT("can't load $module");
- my $version = $module->VERSION;
- $version = 'undefined' unless defined $version;
- diag(" $module version is $version");
- }
- done_testing;
-}
@@ -1,27 +0,0 @@
-#!perl
-#
-# This file is part of Dist-Zilla-Plugin-CriticTests
-#
-# This software is copyright (c) 2009 by Jerome Quelin.
-#
-# This is free software; you can redistribute it and/or modify it under
-# the same terms as the Perl 5 programming language system itself.
-#
-
-BEGIN {
- unless ($ENV{AUTHOR_TESTING}) {
- require Test::More;
- Test::More::plan(skip_all => 'these tests are for testing by the author');
- }
-}
-
-
-use strict;
-use warnings;
-
-use Test::More;
-use English qw(-no_match_vars);
-
-eval "use Test::Perl::Critic";
-plan skip_all => 'Test::Perl::Critic required to criticise code' if $@;
-all_critic_ok();
@@ -0,0 +1,139 @@
+use strict;
+use warnings;
+use autodie;
+use Test::More 0.94;# tests => 2;
+use Test::DZil;
+use Moose::Autobox;
+
+my $rc_content = do { local $/; <DATA>};
+my $test_name = 'xt/author/critic.t';
+
+subtest 'default' => sub {
+ plan tests => 3;
+
+ my $critic_config = 'perlcritic.rc';
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ ('GatherDir', 'CriticTests')
+ ),
+ "source/$critic_config" => $rc_content,
+ },
+ },
+ );
+
+ $tzil->build;
+
+ my $has_test = grep(
+ $_->name eq $test_name,
+ $tzil->files->flatten
+ );
+ ok($has_test, 'Perl::Critic test exists')
+ or diag explain $tzil->files->flatten;
+
+ my $critic_test = $tzil->slurp_file("build/$test_name");
+ like($critic_test, qr{Test::Perl::Critic}, 'We have a Perl::Critic test');
+ like($critic_test, qr{$critic_config}, 'Right config file used');
+};
+
+subtest '.perlcriticrc' => sub {
+ plan tests => 3;
+
+ my $critic_config = '.perlcriticrc';
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ ('GatherDir', ['CriticTests' => { critic_config => $critic_config}])
+ ),
+ "source/$critic_config" => $rc_content,
+ },
+ },
+ );
+
+ $tzil->build;
+
+ my $has_test = grep(
+ $_->name eq $test_name,
+ $tzil->files->flatten
+ );
+ ok($has_test, 'Perl::Critic test exists')
+ or diag explain $tzil->files->flatten;
+
+ my $critic_test = $tzil->slurp_file("build/$test_name");
+ like($critic_test, qr{Test::Perl::Critic}, 'We have a Perl::Critic test');
+ like($critic_test, qr{$critic_config}, 'Right config file used')
+};
+
+subtest 'empty' => sub {
+ plan tests => 3;
+
+ my $critic_config = 'perlcritic.rc';
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ ('GatherDir', ['CriticTests', { critic_config => '' }])
+ ),
+ "source/$critic_config" => $rc_content,
+ },
+ },
+ );
+
+ $tzil->build;
+
+ my $has_test = grep(
+ $_->name eq $test_name,
+ $tzil->files->flatten
+ );
+ ok($has_test, 'Perl::Critic test exists')
+ or diag explain $tzil->files->flatten;
+
+ my $critic_test = $tzil->slurp_file("build/$test_name");
+ like($critic_test, qr{Test::Perl::Critic}, 'We have a Perl::Critic test');
+ like($critic_test, qr{$critic_config}, 'Right config file used')
+};
+
+subtest 'undef' => sub {
+ plan tests => 3;
+
+ my $critic_config = 'perlcritic.rc';
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/dist.ini' => simple_ini(
+ ('GatherDir', ['CriticTests', { critic_config => undef }])
+ ),
+ "source/$critic_config" => $rc_content,
+ },
+ },
+ );
+
+ $tzil->build;
+
+ my $has_test = grep(
+ $_->name eq $test_name,
+ $tzil->files->flatten
+ );
+ ok($has_test, 'Perl::Critic test exists')
+ or diag explain $tzil->files->flatten;
+
+ my $critic_test = $tzil->slurp_file("build/$test_name");
+ like($critic_test, qr{Test::Perl::Critic}, 'We have a Perl::Critic test');
+ like($critic_test, qr{$critic_config}, 'Right config file used')
+};
+
+done_testing;
+
+END { # Remove (empty) dir created by building the dists
+ require File::Path;
+ File::Path::rmtree('tmp');
+}
+
+__DATA__
+severity = 3
@@ -1,23 +0,0 @@
-#!perl
-#
-# This file is part of Dist-Zilla-Plugin-CriticTests
-#
-# This software is copyright (c) 2009 by Jerome Quelin.
-#
-# This is free software; you can redistribute it and/or modify it under
-# the same terms as the Perl 5 programming language system itself.
-#
-
-BEGIN {
- unless ($ENV{RELEASE_TESTING}) {
- require Test::More;
- Test::More::plan(skip_all => 'these tests are for release candidate testing');
- }
-}
-
-
-use Test::More;
-
-eval "use Test::CPAN::Meta";
-plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
-meta_yaml_ok();
@@ -1,24 +0,0 @@
-#!perl
-#
-# This file is part of Dist-Zilla-Plugin-CriticTests
-#
-# This software is copyright (c) 2009 by Jerome Quelin.
-#
-# This is free software; you can redistribute it and/or modify it under
-# the same terms as the Perl 5 programming language system itself.
-#
-
-BEGIN {
- unless ($ENV{RELEASE_TESTING}) {
- require Test::More;
- Test::More::plan(skip_all => 'these tests are for release candidate testing');
- }
-}
-
-
-use Test::More;
-
-eval "use Test::Portability::Files";
-plan skip_all => "Test::Portability::Files required for testing portability"
- if $@;
-run_tests();
@@ -1,24 +0,0 @@
-#!perl
-#
-# This file is part of Dist-Zilla-Plugin-CriticTests
-#
-# This software is copyright (c) 2009 by Jerome Quelin.
-#
-# This is free software; you can redistribute it and/or modify it under
-# the same terms as the Perl 5 programming language system itself.
-#
-
-BEGIN {
- unless ($ENV{RELEASE_TESTING}) {
- require Test::More;
- Test::More::plan(skip_all => 'these tests are for release candidate testing');
- }
-}
-
-
-use Test::More;
-
-eval "use Test::Vars";
-plan skip_all => "Test::Vars required for testing unused vars"
- if $@;
-all_vars_ok();